]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gdm/util: Make sure error is GError before checking it
authorRay Strode <rstrode@redhat.com>
Wed, 15 May 2024 14:47:40 +0000 (10:47 -0400)
committerMarge Bot <marge-bot@gnome.org>
Mon, 20 May 2024 14:38:27 +0000 (14:38 +0000)
The fingerprint device fetching code has a generic error handler,
that assumes the passed in error is GError. If it's not a
GError it will fail trying to use GError specific methods.

This commit adds some validation checking.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3319>

js/gdm/util.js

index 97df6d687e5d3cc9d0afb418cb899c1811ab7c93..303be0d62179befd9cd011b64f3aab3f01f24ff9 100644 (file)
@@ -395,15 +395,16 @@ export class ShellUserVerifier extends Signals.EventEmitter {
     _handleFingerprintError(e) {
         this._fingerprintReaderType = FingerprintReaderType.NONE;
 
-        if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
-            return;
-        if (e.matches(Gio.DBusError, Gio.DBusError.SERVICE_UNKNOWN))
-            return;
-
-        if (Gio.DBusError.is_remote_error(e) &&
-            Gio.DBusError.get_remote_error(e) ===
-                'net.reactivated.Fprint.Error.NoSuchDevice')
-            return;
+        if (e instanceof GLib.Error) {
+            if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
+                return;
+            if (e.matches(Gio.DBusError, Gio.DBusError.SERVICE_UNKNOWN))
+                return;
+            if (Gio.DBusError.is_remote_error(e) &&
+                Gio.DBusError.get_remote_error(e) ===
+                    'net.reactivated.Fprint.Error.NoSuchDevice')
+                return;
+        }
 
         logError(e, 'Failed to interact with fprintd service');
     }